<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>专业信息管理</title>
	<meta name="decorator" content="default"/>
</head>
<body>
<div class="main-content">
	<form:form id="searchForm" modelAttribute="majorInfo" action="${ctx}/school/majorInfo/list?type=mini" method="post" class="form-horizontal">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<div class="row" style="margin-bottom: 4px;">
			<label class="col-sm-2 no-padding-right">大类：</label>
			<select name="majorParentCode">
				<option value="">-请选择-</option>
				<c:forEach items="${fns:getDictList('major_parent_code')}" var="item">
					<option value="${item.value}" <c:if test="${item.value eq param.majorParentCode}">selected</c:if>>${item.label}</option>
				</c:forEach>
			</select>
			<input id="btnSubmit" class="btn btn-primary btn-sm" type="submit" value="查询"/>
		</div>
	</form:form>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
		<tr>
			<th>专业大类</th>
			<th>专业名称</th>
			<th>专业类别</th>
			<th>专业代码</th>
			<th>操作</th>
		</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="majorInfo">
			<tr>
				<td>
						${fns:getDictLabel(majorInfo.majorParentCode, 'major_parent_code', '无')}
				</td>
				<td>
						${majorInfo.majorName}
				</td>
				<td>
						${fns:getDictLabel(majorInfo.majorType, 'major_type', '无')}
				</td>
				<td>
						${majorInfo.majorCode}
				</td>
				<td>
					<a href="javascript:;" onclick="removeMajor('${majorInfo.majorName}','${majorInfo.majorCode}',this);" class="btn btn-warning btn-mini">选择</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</div>
<script type="text/javascript">
	$(document).ready(function() {
	});

	//移除专业
	function removeMajor(majorName,majorCode,obj){
		$(obj).parent().parent().remove();
		//调用父窗口方法
		parent.addMajor(majorName,majorCode);
	}

	function page(n,s){
		$("#pageNo").val(n);
		$("#pageSize").val(s);
		$("#searchForm").submit();
		return false;
	}
</script>
</body>
</html>